﻿@using CoralNode.MvcClient.Helper
@model CoralNode.Core.Entity.SearchQuerys.User.UserSearchQuery

@{
    ViewBag.Title = "Index";
}
@Html.IncludePage("CoralAdmin/user", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_user"></span><span class="t t_c">用户管理&nbsp;&nbsp;/&nbsp;&nbsp;用户管理</span>
        </div>
        <div id="main">
            <div class="">
                <div class="tablelist_style1" data-js="tabellist_style1">
                    <div class="funsearch p_1 pl_2 pr_2 extra_normal">
                        <a class="btn_5 f_r ml_3" href="/m/user/createUser">添加用户</a>
                        <div class="f_r">
                            <form method="POST" action="/m/user/listUser">
                               <span class="t_des f_l pt_0-5">用户账号：</span>
                                <label class="search f_l">
                                    @Html.TextBoxFor(m => m.Account, new { @class = "text w_18", @msg = "请输入关键字" })
                                    @Html.AntiForgeryToken()
                                    <input type="submit" value="" class="submit" /></label>
                            </form>
                        </div>
                    </div>
                    <table cellpadding="0" cellspacing="0">
                        <tr class="exclude">
                            <th width="60">选择</th>
                            <th align="left" width="50">ID</th>
                            <th align="left">账号</th>
                            <th align="left">名称</th>
                            <th align="left">角色</th>
                            <th>状态</th>
                            <th align="center" width="140">操作</th>
                        </tr>
                        @foreach (var item in @ViewBag.UserList.Items)
                        {
                            <tr>
                                <td>
                                    <label class="checkbox_own">
                                        <input type="checkbox" value="@item.Id"/></label></td>
                                <td class="td_left">@item.Id</td>
                                <td class="td_left"><a href="/m/user/editUser/@item.Id">@item.Account</a></td>
                                <td class="td_left">@item.Name</td>
                                <td class="td_left">@item.Role.Name</td>
                                <td><a href="/m/user/ChangeUserStatus/@item.Id" class="ico ico_eye_@item.IsValid js_changestate btn"></a></td>
                                <td>
                                    <div class="fun">
                                        <a href="/m/user/editUser/@item.Id">编辑</a><a href="/m/user/ChangeUserPwd/@item.Id">修改密码</a><a href="/m/user/deleteUser/@item.Id" class="js_delete">删除</a>
                                    </div>
                                </td>
                            </tr>
                        }
                    </table>
                    <div class="global_fun ">
                        <label class="checkbox_own gloabal_select">
                            <input type="checkbox" /></label>
                        <input type="button" class="btn_4 btn invert" value="反选" /><input type="button" class="btn_4 btn reset"
                            value="重置" />
                        <a href="#" class="js_delete">删除</a>
                    </div>
                </div>
            </div>
        </div>
        <div id="pager">
            <div class="info_pg">共@(ViewBag.UserList.TotalItems)条</div>
            <div class="list_pg">
                <a href="/m/user/listUser?@ViewBag.queryString&p=1" class="first">首页</a>
                @if (@ViewBag.UserList.HasPreviousPage && @ViewBag.UserList.TotalItems > 0)
                {
                    <a href="/m/user/listUser?&p=@ViewBag.UserList.PreviousPageIndex" class="prev">上一页</a>
                }
                else
                {
                    <a class="prev none">上一页</a>
                }
                @foreach (var i in @ViewBag.UserList.PageArray)
                {
                    if (@i == @ViewBag.UserList.CurrentPageIndex)
                    {
                    <a class="current">@i</a>
                    }
                    else if (@i == 0)
                    {
                    <a class="more">…</a>
                    }
                    else
                    {
                    <a href="/m/user/listUser?@ViewBag.queryString&p=@i" href="#">@i</a>
                    }
                }
                @if (@ViewBag.UserList.HasNextPage && @ViewBag.UserList.TotalItems > 0)
                {
                    <a class="next" href="/m/user/listUser?@ViewBag.queryString&p=@ViewBag.UserList.NextPageIndex">下一页</a>
                }
                else
                {
                    <a class="next none">下一页</a>
                }
                <a class="last" href="/m/user/listUser?@ViewBag.queryString&p=@ViewBag.UserList.TotalPages">尾页</a>
                <!-- <span class="msg">跳转</span>
                <input class="text" type="text" value="">
                <span class="msg">页</span>-->
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('.nav_left_style2').find('li').eq(0).addClass('current');
    })
</script>
